.global _test_mmu


_test_mmu:
/* r0 shall contain the table address */
/* r1 shall contain VA to be modified */

/* Load TTBR */
mcr p15, 0, r0, c2, c0, 0 

/* Load domain access control register */
ldr r2, =0xFFFFFFFF
mcr p15, 0, r2, c3, c0, 0 

/* Set c13 to 0 */
mov r2, #0
mcr p15, 0, r2, c13, c0, 0 

/* time to enable the TLB */
mrc p15, 0, r2, c1, c0, 0 
orr r2, #0x1 
mcr p15, 0, r2, c1, c0, 0

/* Ensure that any pipelined instructions
* are not accessing any memory
*/
nop
nop
nop
nop
nop
nop
nop
nop
nop

ldr r2, =0xABCDDCBA
str r2, [r1] 

/* Disable mmu */
mrc p15, 0, r2, c1, c0, 0 
bic r2, r2, #0x1 
mcr p15, 0, r2, c1, c0, 0 

/*
* Ensure that any pipelined instructions
* are not accessing any memory
*/
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop

mov pc, lr

.end
